package demo01;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-04-04
 * Time: 19:23
 */
class myThread implements Runnable {
    @Override
    public void run() {
        while(true) {
            System.out.println("多线程");

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            } finally {
            }
        }
    }
}
public class Test03 {
    public static void main(String[] args) {
        Thread t = new Thread(new myThread());
        t.start();

        while(true) {
            System.out.println("主线程");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
